{template admin/header}

<div id="main_wp">
<script type="text/JavaScript">
var rowtypedata = [
	[[1,'<input type="text" size=5 name="new_tcat_order[]" value="0" />', 'td2'], [3, '<input name="new_tcat[]" value="一级频道" type="text"/>', 'td2']],
	[[1,'<input type="text" size=5 class="txt" name="new_scat_order[{1}][]" value="0" />', 'td2'], [3, '<i class="lower"></i><input name="new_scat[{1}][]" value="新子频道" size="20" type="text"/>', 'td2']],
];

var addrowdirect = 0;
function addrow(obj, type) {
	var table = obj.parentNode.parentNode.parentNode;
	if(!addrowdirect) {
		var row = table.insertRow(obj.parentNode.parentNode.rowIndex);
	} else {
		var row = table.insertRow(obj.parentNode.parentNode.rowIndex + 1);
	}
	var typedata = rowtypedata[type];
	for(var i = 0; i <= typedata.length - 1; i++) {
		var cell = row.insertCell(i);
		cell.colSpan = typedata[i][0];
		var tmp = typedata[i][1];
		if(typedata[i][2]) {
			cell.className = typedata[i][2];
		}
		tmp = tmp.replace(/\{(\d+)\}/g, function($1, $2) {return addrow.arguments[parseInt($2) + 1];});
		cell.innerHTML = tmp;
	}
	addrowdirect = 0;
}
</script>
	<form action="admin.php?mod=channel&code=docategory" method="post" name="qcat_form">
	<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="tableborder tl">
		<tr class="header">
			<td colspan="4">频道管理<span style="margin-left:10px;font-size:12px;font-weight:normal;color:#f00">(<a href="admin.php?mod=channel&code=updata">更新数据</a>)</span></td>
		</tr>
		<tr class="list_h">
			<td width="7%" >显示顺序</td>
			<td>频道名称</td>
			<td>$this->Config['changeword']["n_weibo"]条数</td>
			<td>操作</td>
		</tr>
		<!--{loop $tree $key $value}-->
			<tr>
				<td class="td2">
					<input type="text" name="cat_order[{$value[ch_id]}]" size="5" value="{$value[display_order]}"/>
				</td>
				<td class="td2">
					<!--{if $value['parent_id'] !=0}-->
						<i class="lower"></i>
					<!--{/if}-->
					<input type="text" name="cat[{$value[ch_id]}]" value="{$value[ch_name]}"/>
				</td>
				<td class="td2">{$value['total_topic_num']}[本级频道:{$value['topic_num']}]</td>
				<td class="td2"><a href="admin.php?mod=channel&code=edit&id={$value['ch_id']}">编辑</a>&nbsp;|&nbsp;
				<!--{if !$value['child'] && $value['topic_num'] > 0}-->
				<a href="admin.php?mod=channel&code=move&id={$value['ch_id']}">转移</a>&nbsp;|&nbsp;
				<!--{/if}-->
				<a href="javascript:void(0);" onclick="MessageBox('confirm','您确定要删除该频道吗？','系统提示',{'onClickYes':function(){window.location.href='admin.php?mod=channel&code=delcat&ch_id={$value['ch_id']}'}});">删除</a></td>
			</tr>
			<!--{loop $value['child'] $child}-->
				<tr>
					<td class="td2">
						<input type="text" name="cat_order[{$child[ch_id]}]" size="5" value="{$child[display_order]}"/>
					</td>
					<td class="td2">
						<i class="lower"></i>
						<input type="text" name="cat[{$child[ch_id]}]" value="{$child[ch_name]}"/>
					</td>
					<td class="td2">{$child['topic_num']}</td>
					<td class="td2"><a href="admin.php?mod=channel&code=edit&id={$child['ch_id']}">编辑</a>&nbsp;|&nbsp;
					<!--{if $child['topic_num'] > 0}-->
					<a href="admin.php?mod=channel&code=move&id={$child['ch_id']}">转移</a>&nbsp;|&nbsp;
					<!--{else}-->
					<s>转移</s>&nbsp;|&nbsp;
					<!--{/if}-->
					<a href="javascript:void(0);" onclick="MessageBox('confirm','您确定要删除该频道吗？','系统提示',{'onClickYes':function(){window.location.href='admin.php?mod=channel&code=delcat&ch_id={$child['ch_id']}'}});">删除</a></td>
				</tr>
			<!--{/loop}-->
			<tr>
				<td class="td2">
				</td>
				<td colspan="3" class="td2">
					<i class="lower_b"></i>
					<a href="javascript:;" onclick="addrow(this, 1, {$value[ch_id]})" class="addtr">新子频道</a>
				</td>
			</tr>
		<!--{/loop}-->
		<tr>
			<td colspan="4" class="td2"><a href="javascript:;" onclick="addrow(this, 0)" class="addtr">添加一级频道</a></td>
		</tr>
  </table>
	<center><input class="button" type="submit" name="cronssubmit" value="提 交"></center>
</div>